package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Caqzekne type
*/
@SuppressWarnings("ALL")
public class Caqzekne {


        private static volatile Caqzekne instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Caqzekne getInstance() {
            if (instance == null) {
                synchronized (Caqzekne.class) {
                    if (instance == null) {
                        instance = new Caqzekne();
                    }
                }
            }
            return instance;
        }


        private Caqzekne() {

        }



    public  Boolean judgeArdoseiugq(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeHpgnkswfid(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeTdmrohilzz(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeWbhilegkpz(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeDdaotibagr(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeWmbzaglarv(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeOzxyqvnfxz(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeAxehjlaboi(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  ardoseiugq;
    private String  hpgnkswfid;
    private String  tdmrohilzz;
    private String  wbhilegkpz;
    private String  ddaotibagr;
    private String  wmbzaglarv;
    private String  ozxyqvnfxz;
    private String  axehjlaboi;


    public void setArdoseiugq(String ardoseiugq){
    this.ardoseiugq = ardoseiugq;
    }

    public String getArdoseiugq(){
    return this.ardoseiugq;
    }
    public void setHpgnkswfid(String hpgnkswfid){
    this.hpgnkswfid = hpgnkswfid;
    }

    public String getHpgnkswfid(){
    return this.hpgnkswfid;
    }
    public void setTdmrohilzz(String tdmrohilzz){
    this.tdmrohilzz = tdmrohilzz;
    }

    public String getTdmrohilzz(){
    return this.tdmrohilzz;
    }
    public void setWbhilegkpz(String wbhilegkpz){
    this.wbhilegkpz = wbhilegkpz;
    }

    public String getWbhilegkpz(){
    return this.wbhilegkpz;
    }
    public void setDdaotibagr(String ddaotibagr){
    this.ddaotibagr = ddaotibagr;
    }

    public String getDdaotibagr(){
    return this.ddaotibagr;
    }
    public void setWmbzaglarv(String wmbzaglarv){
    this.wmbzaglarv = wmbzaglarv;
    }

    public String getWmbzaglarv(){
    return this.wmbzaglarv;
    }
    public void setOzxyqvnfxz(String ozxyqvnfxz){
    this.ozxyqvnfxz = ozxyqvnfxz;
    }

    public String getOzxyqvnfxz(){
    return this.ozxyqvnfxz;
    }
    public void setAxehjlaboi(String axehjlaboi){
    this.axehjlaboi = axehjlaboi;
    }

    public String getAxehjlaboi(){
    return this.axehjlaboi;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}